﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class WelcomeText : MonoBehaviour {
	public float minDist = 0.1F;
	public float DistDelta = 0.1F;
	public float SizeDelta = 0.01F;
	public float slerpTime = 1;
	private Vector3 destination;
	public Vector3 initialPositionOffset;
	public float initialSizeOffset;
	private float startTime;

	void Awake()
	{
		destination = transform.position;
	}

	void OnEnable()
	{	
		startTime = Time.time;
		transform.position = destination + initialPositionOffset;
		transform.localScale = initialSizeOffset * Vector3.one;
	}

	void Update()
	{
		if (Vector3.Distance(transform.position,destination)>minDist){
			transform.position = Vector3.Lerp (transform.position,destination, (Time.time-startTime)/slerpTime);
			transform.localScale = Vector3.Lerp(transform.localScale,Vector3.one, (Time.time-startTime)/slerpTime);
		}
	}
}
